@extends('layouts.app')
@section('title') 创建优惠@stop
@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                @include('home._banner')
                <div class="card-body">
                    <form action="{{ url('home/create') }}" method="post">
                        <input type="hidden" name="data[id]" value="{{ $good['id'] or ''}}">
                        {{
                        csrf_field()
                        }}
                        <div>
                            分类：
                            <select name="data[cate]" id="">
                                <option @if(empty($good['cate'])) selected @endif value="0">特别推荐</option>
                            @foreach($types as $id => $name)
                                <option @if($id == $good['cate']) selected @endif value="{{ $id or ''}}">{{ $name or '' }}</option>
                                @endforeach
                            </select>
                        </div>

                        <br>
                        <div>
                            标题：<input type="text" name="data[name]" value="{{ $good['name'] or ' ' }}" placeholder="标题">
                        </div>

                        <br>
                        <div>
                            商品价格：<input type="text" name="data[price]" value="{{ $good['price'] or '0' }}" placeholder="商品价格">
                        </div>
                        <br>
                        <div>
                            优惠券金额：<input type="text" name="data[coupon]" value="{{ $good['coupon'] or '0' }}" placeholder="优惠券金额">
                        </div>
                        <br>
                        <div>
                            图片：
                            <div class="G-upload-con" data-limitNum= "4" data-limitsize= "1" data-name = "data[images][]" >
                                @if(!empty($good['img'][0]))
                                    @foreach($good['img'] as $img)
                                            <div class="G-img-item">
                                                <img src="{{ url($img) }}">
                                                <p class="G-img-delete">删除</p>
                                                <input type="hidden" name="data[img][]" value="{{ $img }}">
                                            </div>
                                        @endforeach
                                        @endif
                                <div class="G-img-add">
                                    <input type="file" class="choice-file">
                                    <div class="icon-content">
                                        <i class="iconfont icon-demo02"></i>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <br>
                        <div>
                            <input type="submit">
                            <input type="reset">
                        </div>
                    </form>


                </div>
            </div>
        </div>
    </div>
</div>
@endsection
